#include "bits/stdc++.h"
using namespace std;

int main(int argc, char** argv){

    int n, k;
    cin>>n, k;

    string str;
    cin >> str;

    deque<int> idx(n-k+1);
    for(int i=0; i<idx.size(); i++){
        idx[i] = n-k-i;
    }


    for(int i=0; i<k; i++){
        int max_char = -1;
        int len = idx.size();
        int remove_len = 0;

        for(int j=0; j<len; j++){
            
            int temp_val = str[idx[j]+i]-'a';
            if(temp_val > max_char){
                while(remove_len) {
                    idx.pop_back();
                }
                max_char = temp_val;
                idx.push_back(idx[j]);
                remove_len++;
            }
            else if(temp_val == max_char){
                idx.push_back(idx[j]);
                remove_len++;
            }
            idx.pop_front();
        }

        if(idx.size() == 1){
            
            break;
        }
    }
    string output = str.substr(idx[0], k);
    cout << output << endl;
    
    return 0;
}